<?php
namespace Tbf\Error;
/**
 * @deprecated
 */
class HandleContainer extends \Pimple{
    function __construct(){
        $d['error_to_exception'] = $this->share(function($c){
            return new ErrorToExceptionHandle;
        });
        $d['exception_to_500'] = $this->share(function($c){
            return new ExceptionTo500Handle;
        });
        $d['fatal_error_to_500'] = $this->share(function($c){
            return new FatalErrorTo500Handle;
        });
        parent::__construct($d);
    }

    static function dObj(){
        static $cache = null;
        if ($cache===null){
            $cache = new static;
        }
        return $cache;
    }
    static function errorToException(){
        $di = self::dObj();
        $di['error_to_exception']->handle();
    }
    static function exceptionTo500(){
        $di = self::dObj();
        $di['exception_to_500']->handle();
    }
    static function fatalErrorTo500(){
        $di = self::dObj();
        $di['fatal_error_to_500']->handle();
    }
}
